package sz.com.postoffice.jxyzwgcase.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import sz.com.postoffice.jxyzwgcase.core.BaseResponseEntity;
import sz.com.postoffice.jxyzwgcase.service.IDataSynchronizationService;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

@Api(value = "江西邮政内网数据映射ADO", tags = "{江西邮政内网数据映射ADO}")
@Slf4j
@RestController
@RequestMapping(value = "/dataSynch")
public class DataSynchronizationController {

	@Resource
	private IDataSynchronizationService dataSynchronizationService;

	AtomicInteger count= new AtomicInteger();

	@ApiOperation(value = "江西邮政内网数据映射ADO", notes = "江西邮政内网数据映射ADO")
	@RequestMapping(value = "/dataSynchronization", method = RequestMethod.POST,produces = "application/json")
	public BaseResponseEntity dataSynchronization(HttpServletRequest request,@RequestBody Map map) throws Exception {
		count.getAndIncrement();
		int i = count.get();
		log.info("收集内网数据映射ADO第{}次",i);
		dataSynchronizationService.dataSynchronization(map);

		return BaseResponseEntity.success(0,"新增成功.",null);
	}


}
